package com.wanbangee.marksystem.service.imp;


import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.wanbangee.marksystem.dao.USchoolDao;
import com.wanbangee.marksystem.entities.USchool;
import com.wanbangee.marksystem.service.USchoolService;
@Service
public class USchoolServiceImp implements USchoolService {
	@Autowired
	private USchoolDao getSchoolInformationDao;

	@Override
	public USchool getSchoolInformationBySchIdService(int schId) {
		USchool list = getSchoolInformationDao.getSchoolInformationBySchId(schId);
		return list;
	}

	@Override
	public int insertSchoolInformation(USchool uSchool) {
		int state = getSchoolInformationDao.insertSchoolInformation(uSchool);
		return state;
	}

	@Override
	public int updateSchool(USchool uSchool) {
		int updateState = getSchoolInformationDao.updateSchool(uSchool);
		return updateState;
	}

	@Override
	public List<USchool> selectSchoolByschNmAndLevel(String schNm, int schLevel) {
		List<USchool> list = getSchoolInformationDao.selectSchoolByschNmAndLevel("%"+schNm+"%", schLevel);
		return list;
	}

	@Override
	public int deleteSchool(int schId) {
		int deleteState = getSchoolInformationDao.deleteSchool(schId);
		return deleteState;
	}

	@Override
	public int updateSchState(int schId, int schState) {
		int updateSchState = this.getSchoolInformationDao.updateSchState(schId, schState);
		return updateSchState;
	}

	/**
	 * 分页查询所有学校
	 * @param paging
	 * @param size
	 * @return
	 */
	/**
	 * 分页查询所有学校
	 * @param paging
	 * @param size
	 * @return
	 */
	public List<USchool> selectSchoolBypaging(Integer paging,Integer size){
		return this.getSchoolInformationDao.selectSchoolBypaging((paging-1)*size, size);
	}
	
	/**
	 * 查询一共有多少笔数据
	 * @return
	 */
	public Integer selectSchool() {
		return this.getSchoolInformationDao.selectSchool();
	}
}
